﻿namespace ACCOUNTING
{
    using ACCOUNTING.LVY.Business;
    using ACCOUNTING.My;
    using ACCOUNTING.My.Resources;
    using C1.Win.C1FlexGrid;
    using C1.Win.C1FlexGrid.Util.BaseControls;
    using Microsoft.VisualBasic;
    using Microsoft.VisualBasic.CompilerServices;
    using System;
    using System.Collections.Generic;
    using System.ComponentModel;
    using System.Data;
    using System.Diagnostics;
    using System.Drawing;
    using System.Runtime.CompilerServices;
    using System.Runtime.InteropServices;
    using System.Windows.Forms;

    [DesignerGenerated]
    public class Frm_KiemKeHangTonKho : Form
    {
        private static List<WeakReference> __ENCList = new List<WeakReference>();
        [AccessedThroughProperty("CmdAdd")]
        private ToolStripButton _CmdAdd;
        [AccessedThroughProperty("CmdDel")]
        private ToolStripButton _CmdDel;
        [AccessedThroughProperty("CmdEdit")]
        private ToolStripButton _CmdEdit;
        [AccessedThroughProperty("CmdExit")]
        private ToolStripButton _CmdExit;
        [AccessedThroughProperty("CmdHelp")]
        private ToolStripButton _CmdHelp;
        [AccessedThroughProperty("CmdLapPhieuXuat")]
        private ToolStripButton _CmdLapPhieuXuat;
        [AccessedThroughProperty("CmdPrint")]
        private ToolStripButton _CmdPrint;
        [AccessedThroughProperty("CmdSave")]
        private ToolStripButton _CmdSave;
        [AccessedThroughProperty("CmdUnsave")]
        private ToolStripButton _CmdUnsave;
        [AccessedThroughProperty("CobKho")]
        private ComboBox _CobKho;
        [AccessedThroughProperty("DTPNgayKK")]
        private DateTimePicker _DTPNgayKK;
        [AccessedThroughProperty("Label1")]
        private Label _Label1;
        [AccessedThroughProperty("Label2")]
        private Label _Label2;
        [AccessedThroughProperty("Panel1")]
        private Panel _Panel1;
        [AccessedThroughProperty("ToolStrip1")]
        private ToolStrip _ToolStrip1;
        [AccessedThroughProperty("VsList")]
        private C1.Win.C1FlexGrid.C1FlexGrid _VsList;
        private IContainer components;
        private string khoaKiemKe;
        private bool mAllowAdd;
        private bool mAllowDel;
        private bool mAllowEdit;
        private bool mAllowView;
        private clsKiemKeHangHoa objKKHH;
        private clsKiemKeHangHoaChiTiet objKKHHCT;
        private string pTask;
        private double temp;
        private bool xayRaSuKien;

        public Frm_KiemKeHangTonKho()
        {
            base.KeyDown += new KeyEventHandler(this.Frm_KiemKeHangTonKho_KeyDown);
            base.Load += new EventHandler(this.Frm_KiemKeHangTonKho_Load);
            List<WeakReference> list = __ENCList;
            lock (list)
            {
                __ENCList.Add(new WeakReference(this));
            }
            this.temp = 0.0;
            this.objKKHH = new clsKiemKeHangHoa();
            this.objKKHHCT = new clsKiemKeHangHoaChiTiet();
            this.xayRaSuKien = false;
            this.InitializeComponent();
        }

        private void CapNhatKiemKe()
        {
            int num2 = this.VsList.Rows.Count - 1;
            for (int i = 1; i <= num2; i++)
            {
                try
                {
                    object obj2 = Microsoft.VisualBasic.CompilerServices.Operators.ConcatenateObject(Microsoft.VisualBasic.CompilerServices.Operators.ConcatenateObject(Microsoft.VisualBasic.CompilerServices.Operators.ConcatenateObject(Microsoft.VisualBasic.CompilerServices.Operators.ConcatenateObject(("update ST_KiemKeHangHoaChiTiet set SoLuongKiemKe=" + Conversions.ToString(Conversions.ToDouble(LVYModule.ReturnIfNull(RuntimeHelpers.GetObjectValue(this.VsList[i, 11]), 0, modGeneral.TypeOfValue.Number))) + " ,SoLuongChenhLech=") + Conversions.ToString(Conversions.ToDouble(LVYModule.ReturnIfNull(RuntimeHelpers.GetObjectValue(this.VsList[i, 13]), 0, modGeneral.TypeOfValue.Number))) + " where KhoaKiemKe='", LVYModule.ReturnIfNull(this.khoaKiemKe, "", modGeneral.TypeOfValue.Nothing)), "' and KhoaHangHoa='"), LVYModule.ReturnIfNull(RuntimeHelpers.GetObjectValue(this.VsList[i, 1]), "", modGeneral.TypeOfValue.Nothing)), "'");
                    DBHelper.ExecuteNonQuery(modGeneral.ConnectionString, CommandType.Text, Conversions.ToString(obj2), new IDataParameter[0]);
                }
                catch (Exception exception1)
                {
                    ProjectData.SetProjectError(exception1);
                    Exception exception = exception1;
                    Interaction.MsgBox(exception.Message.ToString(), MsgBoxStyle.OkOnly, null);
                    ProjectData.ClearProjectError();
                }
            }
        }

        private void CmdAdd_Click(object sender, EventArgs e)
        {
            object obj2 = Strings.Left(LVYModule.Date2Char(Strings.Format(this.DTPNgayKK.Value, "dd/MM/yyyy")), 6) + "'";
            string right = this.NgayKiemKeGanNhat(Conversions.ToString(this.CobKho.SelectedValue));
            if (Microsoft.VisualBasic.CompilerServices.Operators.CompareString(LVYModule.Date2Char(Strings.Format(this.DTPNgayKK.Value, "dd/MM/yyyy")), right, false) < 0)
            {
                Interaction.MsgBox("Ng\x00e0y hiện tại kh\x00f4ng thể nhỏ hơn ng\x00e0y đ\x00e3 kiễm k\x00ea gần đ\x00e2y nhất (" + LVYModule.Char2Date(right) + " )", MsgBoxStyle.OkOnly, null);
            }
            else
            {
                this.LoadHangHoa(Conversions.ToString(obj2), Conversions.ToString(this.CobKho.SelectedValue));
                if (this.VsList.Rows.Count <= 1)
                {
                    Interaction.MsgBox("Hiện tại kh\x00f4ng c\x00f3 h\x00e0ng h\x00f3a trong kho n\x00e0y.Kh\x00f4ng thể kiểm k\x00ea.", MsgBoxStyle.OkOnly, null);
                }
                else
                {
                    this.pTask = "I";
                    this.RefreshControls(false);
                    this.CmdSave.Enabled = true;
                    this.CmdUnsave.Enabled = true;
                }
            }
        }

        private void CmdDel_Click(object sender, EventArgs e)
        {
            if (LVYModule.ConfirmDelete(""))
            {
                object obj2 = Strings.Left(LVYModule.Date2Char(Strings.Format(this.DTPNgayKK.Value, "dd/MM/yyyy")), 6) + "'";
                if (this.DaKiemKe(LVYModule.Date2Char(Strings.Format(this.DTPNgayKK.Value, "dd/MM/yyyy")), Conversions.ToString(this.CobKho.SelectedValue), ref this.khoaKiemKe))
                {
                    try
                    {
                        object obj3 = "delete ST_KiemKeHangHoa where Khoa='" + this.khoaKiemKe + "'";
                        DBHelper.ExecuteNonQuery(modGeneral.ConnectionString, CommandType.Text, Conversions.ToString(obj3), new IDataParameter[0]);
                        obj3 = "delete ST_KiemKeHangHoaChiTiet where KhoaKiemKe ='" + this.khoaKiemKe + "'";
                        DBHelper.ExecuteNonQuery(modGeneral.ConnectionString, CommandType.Text, Conversions.ToString(obj3), new IDataParameter[0]);
                        this.EmptyGrid();
                        this.RefreshControls(false);
                        this.CmdAdd.Enabled = true;
                    }
                    catch (Exception exception1)
                    {
                        ProjectData.SetProjectError(exception1);
                        Exception exception = exception1;
                        Interaction.MsgBox(exception.Message.ToString(), MsgBoxStyle.OkOnly, null);
                        ProjectData.ClearProjectError();
                    }
                }
            }
        }

        private void CmdEdit_Click(object sender, EventArgs e)
        {
            this.RefreshControls(false);
            this.CmdSave.Enabled = true;
            this.CmdUnsave.Enabled = true;
        }

        private void CmdExit_Click(object sender, EventArgs e)
        {
            if (this.CmdSave.Enabled)
            {
                object left = Interaction.MsgBox("Bạn c\x00f3 muốn lưu lại sự thay đổi kh\x00f4ng ?", MsgBoxStyle.YesNoCancel, null);
                if (Microsoft.VisualBasic.CompilerServices.Operators.ConditionalCompareObjectEqual(left, 6, false))
                {
                    this.CmdSave_Click(RuntimeHelpers.GetObjectValue(sender), e);
                }
                else if (Microsoft.VisualBasic.CompilerServices.Operators.ConditionalCompareObjectEqual(left, 2, false))
                {
                    return;
                }
            }
            this.Close();
        }

        private void CmdLapPhieuXuat_Click(object sender, EventArgs e)
        {
            if (this.VsList.Rows.Count > 1)
            {
                if (this.khoaKiemKe == "")
                {
                    Interaction.MsgBox("Kho:" + this.CobKho.Text + " ng\x00e0y: " + Strings.Format(this.DTPNgayKK.Value, "dd/MM/yyyy") + " chưa được kiểm k\x00ea.Kh\x00f4ng thể lập phiếu xuất !", MsgBoxStyle.OkOnly, null);
                }
                else
                {
                    MyProject.Forms.Frm_XuatKho.mKhoaKiemKe = this.khoaKiemKe;
                    MyProject.Forms.Frm_XuatKho.ShowDialog();
                }
            }
        }

        private void CmdPrint_Click(object sender, EventArgs e)
        {
            DataTable dataTable = this.LayDuLieuIn(Conversions.ToString(this.CobKho.SelectedValue), LVYModule.Date2Char(Strings.Format(this.DTPNgayKK.Value, "dd/MM/yyyy")));
            if (dataTable.Rows.Count < 1)
            {
                Interaction.MsgBox("Kh\x00f4ng c\x00f3 dữ liệu", MsgBoxStyle.OkOnly, null);
                this.Cursor = Cursors.Default;
            }
            else
            {
                this.Cursor = Cursors.WaitCursor;
                Rpt_KiemKeHangTonThuc thuc = new Rpt_KiemKeHangTonThuc();
                try
                {
                    thuc.SetDataSource(dataTable);
                    thuc.Subreports[0].SetDataSource(modGeneral.H_DATACOMPANY);
                    if (modGeneral.H_LANGUAGE == "VIET")
                    {
                        thuc.SetParameterValue(0, modGeneral.Tranlated(modGeneral.H_COMPANYNAMEVIET, ""));
                    }
                    else
                    {
                        thuc.SetParameterValue(0, modGeneral.Tranlated(modGeneral.H_COMPANYNAMEANH, ""));
                    }
                    thuc.SetParameterValue(1, modGeneral.Tranlated("Địa chỉ", "") + ": " + modGeneral.H_ADDRESS);
                    thuc.SetParameterValue(2, modGeneral.Tranlated("Mã s\x00f4́ thu\x00eá", "") + ": " + modGeneral.H_TAXCODE);
                    thuc.SetParameterValue(3, modGeneral.Tranlated("Điện thoại", "") + ": " + modGeneral.H_TELEPHONE);
                    thuc.SetParameterValue(4, modGeneral.Tranlated("Fax", "") + ": " + modGeneral.H_FAX);
                    thuc.SetParameterValue(5, modGeneral.Tranlated("BẢNG K\x00ca H\x00c0NG TỒN THỰC", ""));
                    thuc.SetParameterValue(6, modGeneral.Tranlated("Kho", "") + " : " + this.CobKho.Text);
                    thuc.SetParameterValue(7, modGeneral.Tranlated("Ng\x00e0y kiểm k\x00ea", "") + " : " + this.DTPNgayKK.Text);
                    thuc.SetParameterValue(8, modGeneral.Tranlated("STT", ""));
                    thuc.SetParameterValue(9, modGeneral.Tranlated("M\x00e3", ""));
                    thuc.SetParameterValue(10, modGeneral.Tranlated("T\x00ean h\x00e0ng h\x00f3a", ""));
                    thuc.SetParameterValue(11, modGeneral.Tranlated("ĐVT", ""));
                    thuc.SetParameterValue(12, modGeneral.Tranlated("Số lượng tồn", ""));
                    thuc.SetParameterValue(13, modGeneral.Tranlated("Số kiểm k\x00ea", ""));
                    thuc.SetParameterValue(14, modGeneral.Tranlated("Ch\x00eanh lệch", ""));
                    thuc.SetParameterValue(15, modGeneral.Tranlated("Ng\x00e0y .... th\x00e1ng .... năm ........", ""));
                    thuc.SetParameterValue(0x10, modGeneral.Tranlated("Lập biểu", ""));
                    MyProject.Forms.Frm_ViewReport.ReportViewer.ReportSource = thuc;
                    MyProject.Forms.Frm_ViewReport.ReportViewer.DisplayGroupTree = true;
                    this.Cursor = Cursors.Default;
                    MyProject.Forms.Frm_ViewReport.ShowDialog();
                }
                catch (Exception exception1)
                {
                    ProjectData.SetProjectError(exception1);
                    Exception exception = exception1;
                    MessageBox.Show(exception.Message.ToString());
                    ProjectData.ClearProjectError();
                }
            }
        }

        private void CmdSave_Click(object sender, EventArgs e)
        {
            this.CobKho.Focus();
            if (this.pTask == "I")
            {
                this.ThemMoi();
            }
            else
            {
                this.CapNhatKiemKe();
            }
            this.pTask = "U";
            this.RefreshControls(true);
            this.CmdSave.Enabled = false;
            this.CmdUnsave.Enabled = false;
            this.CmdAdd.Enabled = false;
        }

        private void CmdSave_EnabledChanged(object sender, EventArgs e)
        {
            if (this.CmdSave.Enabled)
            {
                this.CobKho.Enabled = false;
                this.DTPNgayKK.Enabled = false;
                this.CmdPrint.Enabled = false;
                this.CmdLapPhieuXuat.Enabled = false;
            }
            else
            {
                this.CobKho.Enabled = true;
                this.DTPNgayKK.Enabled = true;
                this.CmdPrint.Enabled = true;
                this.CmdLapPhieuXuat.Enabled = true;
            }
        }

        private void CmdUnsave_Click(object sender, EventArgs e)
        {
            this.LoadKiemKe();
        }

        private void CobKho_SelectedIndexChanged(object sender, EventArgs e)
        {
            if (this.xayRaSuKien)
            {
                this.LoadKiemKe();
            }
        }

        private bool DaKiemKe(string ngay, string kho, ref string khoaKiemKe)
        {
            try
            {
                object obj2 = "select Khoa from ST_KiemKeHangHoa where NgayKiemKe='" + ngay + "' and KhoaKho='" + kho + "'";
                if (DBHelper.ExecuteDataset(modGeneral.ConnectionString, CommandType.Text, Conversions.ToString(obj2), new IDataParameter[0]).Tables[0].Rows.Count > 0)
                {
                    khoaKiemKe = DBHelper.ExecuteDataset(modGeneral.ConnectionString, CommandType.Text, Conversions.ToString(obj2), new IDataParameter[0]).Tables[0].Rows[0]["Khoa"].ToString();
                    return true;
                }
            }
            catch (Exception exception1)
            {
                ProjectData.SetProjectError(exception1);
                Exception exception = exception1;
                Interaction.MsgBox(exception.Message.ToString(), MsgBoxStyle.OkOnly, null);
                bool flag = true;
                ProjectData.ClearProjectError();
                return flag;
                ProjectData.ClearProjectError();
            }
            khoaKiemKe = "";
            return false;
        }

        [DebuggerNonUserCode]
        protected override void Dispose(bool disposing)
        {
            if (disposing && (this.components != null))
            {
                this.components.Dispose();
            }
            base.Dispose(disposing);
        }

        private void DTPNgayKK_ValueChanged(object sender, EventArgs e)
        {
            if (this.xayRaSuKien)
            {
                this.LoadKiemKe();
            }
        }

        private void EmptyGrid()
        {
            this.VsList.DataSource = null;
            C1.Win.C1FlexGrid.C1FlexGrid vsList = this.VsList;
            vsList.Cols[0].Visible = false;
            vsList.Cols[1].Visible = false;
            vsList.Cols[2].Visible = false;
            vsList.Cols[3].Visible = false;
            vsList.Cols[4].Visible = false;
            vsList.Cols[5].Visible = false;
            vsList.Cols[6].Visible = false;
            vsList.Cols[7].Caption = "M\x00e3";
            vsList.Cols[7].Width = 70;
            vsList.Cols[8].Caption = "T\x00ean h\x00e0ng h\x00f3a";
            vsList.Cols[9].Caption = "ĐVT";
            vsList.Cols[9].Width = 70;
            vsList.Cols[10].Caption = "Số lượng tồn";
            vsList.Cols[10].Width = 70;
            vsList.Cols[10].Format = "#,###,##0.##";
            vsList.Cols[11].Caption = "Số kiểm k\x00ea";
            vsList.Cols[11].Width = 70;
            vsList.Cols[11].Format = "#,###,##0.##";
            vsList.Cols[12].Visible = false;
            vsList.Cols[13].Caption = "Ch\x00eanh lệch";
            vsList.Cols[13].Width = 70;
            vsList.Cols[13].Format = "#,###,##0.##";
            vsList.Cols[8].Width = vsList.Width - (((((vsList.Cols[13].Width + vsList.Cols[11].Width) + vsList.Cols[10].Width) + vsList.Cols[9].Width) + vsList.Cols[7].Width) + 10);
            vsList.Rows.Count = 1;
            vsList = null;
        }

        private void FG_DSHangHoa_AfterEdit(object sender, RowColEventArgs e)
        {
            if (Conversions.ToDouble(LVYModule.ReturnIfNull(RuntimeHelpers.GetObjectValue(this.VsList[e.Row, 11]), 0, modGeneral.TypeOfValue.Number)) < 0.0)
            {
                Interaction.MsgBox("Số kiểm k\x00ea kh\x00f4ng \x00e2m", MsgBoxStyle.OkOnly, null);
                this.VsList[e.Row, 11] = this.temp;
            }
            this.VsList[e.Row, 13] = Conversions.ToDouble(this.VsList[e.Row, 10]) - Conversions.ToDouble(this.VsList[e.Row, 11]);
            if (Conversions.ToDouble(LVYModule.ReturnIfNull(RuntimeHelpers.GetObjectValue(this.VsList[e.Row, 13]), 0, modGeneral.TypeOfValue.Number)) != 0.0)
            {
                this.FillRow(e.Row, "Linen");
            }
            else
            {
                this.FillRow(e.Row, "White");
            }
        }

        private void FG_DSHangHoa_AfterSort(object sender, SortColEventArgs e)
        {
            this.RefreshGridColor();
            this.FillRows();
            this.FillColunm(11);
        }

        private void FG_DSHangHoa_BeforeEdit(object sender, RowColEventArgs e)
        {
            if ((e.Col == 11) && this.CmdSave.Enabled)
            {
                e.Cancel = false;
            }
            else
            {
                e.Cancel = true;
            }
        }

        private void FG_DSHangHoa_MouseClick(object sender, MouseEventArgs e)
        {
            if ((this.VsList.Rows.Count > 1) && (this.VsList.Row > 0))
            {
                this.temp = Conversions.ToDouble(this.VsList[this.VsList.Row, 11]);
            }
        }

        private void FillColunm(int col)
        {
            int num2 = this.VsList.Rows.Count - 1;
            for (int i = 1; i <= num2; i++)
            {
                CellStyle style = this.VsList.Styles["LightCyan"];
                if (style == null)
                {
                    style = this.VsList.Styles.Add("LightCyan");
                    style.BackColor = Color.LightCyan;
                }
                //this.VsList.GetCellRange(i, col).Style = style;
            }
        }

        private void FillRow(int r, string c)
        {
            CellStyle style = this.VsList.Styles[c];
            if (style == null)
            {
                style = this.VsList.Styles.Add(c);
                if (c == "Linen")
                {
                    style.BackColor = Color.Linen;
                }
                else
                {
                    style.BackColor = Color.White;
                }
            }
            int num2 = this.VsList.Cols.Count - 1;
            for (int i = 0; i <= num2; i++)
            {
                if (i != 11)
                {
                    //this.VsList.GetCellRange(r, i).Style = style;
                }
            }
        }

        private void FillRows()
        {
            int num3 = this.VsList.Rows.Count - 1;
            for (int i = 1; i <= num3; i++)
            {
                if (Conversions.ToDouble(LVYModule.ReturnIfNull(RuntimeHelpers.GetObjectValue(this.VsList[i, 13]), 0, modGeneral.TypeOfValue.Nothing)) != 0.0)
                {
                    CellStyle style = this.VsList.Styles["Linen"];
                    if (style == null)
                    {
                        style = this.VsList.Styles.Add("Linen");
                        style.BackColor = Color.Linen;
                    }
                    int num4 = this.VsList.Cols.Count - 1;
                    for (int j = 0; j <= num4; j++)
                    {
                        if (j != 11)
                        {
                            //this.VsList.GetCellRange(i, j).Style = style;
                        }
                    }
                }
            }
        }

        private void Frm_KiemKeHangTonKho_KeyDown(object sender, KeyEventArgs e)
        {
            switch (e.KeyCode)
            {
                case Keys.F2:
                    if (this.CmdEdit.Enabled)
                    {
                        this.CmdEdit_Click(RuntimeHelpers.GetObjectValue(sender), e);
                    }
                    break;

                case Keys.F7:
                    if (this.CmdDel.Enabled)
                    {
                        this.CmdDel_Click(RuntimeHelpers.GetObjectValue(sender), e);
                    }
                    break;

                case Keys.F8:
                    if (this.CmdAdd.Enabled)
                    {
                        this.CmdAdd_Click(RuntimeHelpers.GetObjectValue(sender), e);
                    }
                    break;

                case Keys.F10:
                    if (this.CmdSave.Enabled)
                    {
                        this.CmdSave_Click(RuntimeHelpers.GetObjectValue(sender), e);
                    }
                    break;

                case Keys.F11:
                    if (this.CmdUnsave.Enabled)
                    {
                        this.CmdUnsave_Click(RuntimeHelpers.GetObjectValue(sender), e);
                    }
                    break;

                case Keys.Return:
                    this.VsList.Focus();
                    if ((this.VsList.Rows.Count > 1) && (this.VsList.Row > 0))
                    {
                        this.VsList.Select(this.VsList.Row, 11);
                    }
                    break;
            }
        }

        private void Frm_KiemKeHangTonKho_Load(object sender, EventArgs e)
        {
            this.xayRaSuKien = false;
            LVYModule.GetUserRight(ref this.mAllowView, ref this.mAllowDel, ref this.mAllowEdit, ref this.mAllowAdd, Conversions.ToString(this.Tag), modGeneral.H_USERNAME);
            if (!this.mAllowView)
            {
                LVYModule.ShowWarning(modGeneral.Tranlated("Bạn kh\x00f4ng c\x00f3 quyền xem, li\x00ean hệ với người quản trị để biết th\x00eam chi tiết.", ""));
                this.Dispose();
            }
            else
            {
                BuildComboModule.BuildCombo(this.CobKho, modGeneral.ListDanhMuc.KhoHang, false, "", "");
                this.xayRaSuKien = true;
                this.CobKho.SelectedIndex = 0;
            }
        }

        [DebuggerStepThrough]
        private void InitializeComponent()
        {
            ComponentResourceManager manager = new ComponentResourceManager(typeof(Frm_KiemKeHangTonKho));
            this.Label2 = new Label();
            this.Label1 = new Label();
            this.CobKho = new ComboBox();
            this.DTPNgayKK = new DateTimePicker();
            this.ToolStrip1 = new ToolStrip();
            this.CmdAdd = new ToolStripButton();
            this.CmdEdit = new ToolStripButton();
            this.CmdDel = new ToolStripButton();
            this.CmdExit = new ToolStripButton();
            this.CmdHelp = new ToolStripButton();
            this.CmdSave = new ToolStripButton();
            this.CmdUnsave = new ToolStripButton();
            this.CmdPrint = new ToolStripButton();
            this.CmdLapPhieuXuat = new ToolStripButton();
            this.Panel1 = new Panel();
            this.VsList = new C1.Win.C1FlexGrid.C1FlexGrid();
            this.ToolStrip1.SuspendLayout();
            this.Panel1.SuspendLayout();
            this.VsList.BeginInit();
            this.SuspendLayout();
            this.Label2.AutoSize = true;
            this.Label2.BackColor = Color.Transparent;
            Point point = new Point(0xd4, 14);
            this.Label2.Location = point;
            this.Label2.Name = "Label2";
            Size size = new Size(0x35, 13);
            this.Label2.Size = size;
            this.Label2.TabIndex = 3;
            this.Label2.Text = "Kho h\x00e0ng";
            this.Label1.AutoSize = true;
            this.Label1.BackColor = Color.Transparent;
            point = new Point(20, 14);
            this.Label1.Location = point;
            this.Label1.Name = "Label1";
            size = new Size(0x48, 13);
            this.Label1.Size = size;
            this.Label1.TabIndex = 2;
            this.Label1.Text = "Ng\x00e0y kiểm k\x00ea";
            this.CobKho.DropDownStyle = ComboBoxStyle.DropDownList;
            this.CobKho.FormattingEnabled = true;
            point = new Point(0x10f, 11);
            this.CobKho.Location = point;
            this.CobKho.Name = "CobKho";
            size = new Size(0x124, 0x15);
            this.CobKho.Size = size;
            this.CobKho.TabIndex = 1;
            this.DTPNgayKK.Format = DateTimePickerFormat.Short;
            point = new Point(0x62, 11);
            this.DTPNgayKK.Location = point;
            this.DTPNgayKK.Name = "DTPNgayKK";
            size = new Size(0x5f, 20);
            this.DTPNgayKK.Size = size;
            this.DTPNgayKK.TabIndex = 0;
            this.ToolStrip1.BackgroundImage = ACCOUNTING.My.Resources.Resources.bgbluenoborder;
            this.ToolStrip1.Items.AddRange(new ToolStripItem[] { this.CmdAdd, this.CmdEdit, this.CmdDel, this.CmdExit, this.CmdHelp, this.CmdSave, this.CmdUnsave, this.CmdPrint, this.CmdLapPhieuXuat });
            point = new Point(0, 0);
            this.ToolStrip1.Location = point;
            this.ToolStrip1.Name = "ToolStrip1";
            size = new Size(0x386, 0x19);
            this.ToolStrip1.Size = size;
            this.ToolStrip1.TabIndex = 0x76;
            this.ToolStrip1.Text = "ToolStrip1";
            this.CmdAdd.Image = (Image) manager.GetObject("CmdAdd.Image");
            this.CmdAdd.ImageTransparentColor = Color.White;
            this.CmdAdd.Name = "CmdAdd";
            size = new Size(0x45, 0x16);
            this.CmdAdd.Size = size;
            this.CmdAdd.Text = "&Kiểm k\x00ea";
            this.CmdAdd.ToolTipText = "Kiểm k\x00ea h\x00e0ng h\x00f3a  ( F8 )";
            this.CmdEdit.Image = (Image) manager.GetObject("CmdEdit.Image");
            this.CmdEdit.ImageTransparentColor = Color.White;
            this.CmdEdit.Name = "CmdEdit";
            size = new Size(0x2e, 0x16);
            this.CmdEdit.Size = size;
            this.CmdEdit.Text = "&Sửa";
            this.CmdEdit.ToolTipText = "Sửa ( F2 )";
            this.CmdDel.Enabled = false;
            this.CmdDel.Image = (Image) manager.GetObject("CmdDel.Image");
            this.CmdDel.ImageTransparentColor = Color.White;
            this.CmdDel.Name = "CmdDel";
            size = new Size(0x2f, 0x16);
            this.CmdDel.Size = size;
            this.CmdDel.Text = "&X\x00f3a";
            this.CmdDel.ToolTipText = "X\x00f3a ( F7 )";
            this.CmdExit.Alignment = ToolStripItemAlignment.Right;
            this.CmdExit.Image = (Image) manager.GetObject("CmdExit.Image");
            this.CmdExit.ImageTransparentColor = Color.White;
            this.CmdExit.Name = "CmdExit";
            size = new Size(0x3a, 0x16);
            this.CmdExit.Size = size;
            this.CmdExit.Text = "Th&o\x00e1t";
            this.CmdExit.ToolTipText = "Tho\x00e1t";
            this.CmdHelp.Alignment = ToolStripItemAlignment.Right;
            this.CmdHelp.Image = (Image) manager.GetObject("CmdHelp.Image");
            this.CmdHelp.ImageTransparentColor = Color.Magenta;
            this.CmdHelp.Name = "CmdHelp";
            size = new Size(0x34, 0x16);
            this.CmdHelp.Size = size;
            this.CmdHelp.Text = "&Help";
            this.CmdSave.Enabled = false;
            this.CmdSave.Image = (Image) manager.GetObject("CmdSave.Image");
            this.CmdSave.ImageTransparentColor = Color.WhiteSmoke;
            this.CmdSave.Name = "CmdSave";
            size = new Size(0x2f, 0x16);
            this.CmdSave.Size = size;
            this.CmdSave.Text = "&Lưu";
            this.CmdSave.ToolTipText = "Lưu ( F10 )";
            this.CmdUnsave.Enabled = false;
            this.CmdUnsave.Image = (Image) manager.GetObject("CmdUnsave.Image");
            this.CmdUnsave.ImageTransparentColor = Color.White;
            this.CmdUnsave.Name = "CmdUnsave";
            size = new Size(0x39, 0x16);
            this.CmdUnsave.Size = size;
            this.CmdUnsave.Text = "&K.Lưu";
            this.CmdUnsave.ToolTipText = "K.Lưu ( F11)";
            this.CmdPrint.Image = (Image) manager.GetObject("CmdPrint.Image");
            this.CmdPrint.ImageTransparentColor = Color.White;
            this.CmdPrint.Name = "CmdPrint";
            size = new Size(0x25, 0x16);
            this.CmdPrint.Size = size;
            this.CmdPrint.Text = "&In";
            this.CmdPrint.ToolTipText = "In ( F9)";
            this.CmdLapPhieuXuat.Image = (Image) manager.GetObject("CmdLapPhieuXuat.Image");
            this.CmdLapPhieuXuat.ImageTransparentColor = Color.White;
            this.CmdLapPhieuXuat.Name = "CmdLapPhieuXuat";
            size = new Size(0x68, 0x16);
            this.CmdLapPhieuXuat.Size = size;
            this.CmdLapPhieuXuat.Text = "&Lập phiếu xuất";
            this.CmdLapPhieuXuat.ToolTipText = "Lập phiếu xuất ( F8 )";
            this.Panel1.BackgroundImage = ACCOUNTING.My.Resources.Resources.bgleft;
            this.Panel1.Controls.Add(this.CobKho);
            this.Panel1.Controls.Add(this.Label2);
            this.Panel1.Controls.Add(this.DTPNgayKK);
            this.Panel1.Controls.Add(this.Label1);
            this.Panel1.Dock = DockStyle.Top;
            point = new Point(0, 0x19);
            this.Panel1.Location = point;
            this.Panel1.Name = "Panel1";
            size = new Size(0x386, 0x26);
            this.Panel1.Size = size;
            this.Panel1.TabIndex = 0x77;
            this.VsList.AutoResize = false;
            this.VsList.BorderStyle = C1.Win.C1FlexGrid.Util.BaseControls.BorderStyleEnum.Light3D;
            this.VsList.ColumnInfo = manager.GetString("VsList.ColumnInfo");
            this.VsList.Dock = DockStyle.Fill;
            this.VsList.ExtendLastCol = true;
            point = new Point(0, 0x3f);
            this.VsList.Location = point;
            this.VsList.Name = "VsList";
            this.VsList.Rows.Count = 1;
            this.VsList.Rows.DefaultSize = 0x11;
            this.VsList.Rows.MaxSize = 20;
            this.VsList.Rows.MinSize = 20;
            this.VsList.SelectionMode = SelectionModeEnum.Cell;
            size = new Size(0x386, 0x1fc);
            this.VsList.Size = size;
            this.VsList.StyleInfo = manager.GetString("VsList.StyleInfo");
            this.VsList.TabIndex = 0x80;
            this.VsList.VisualStyle = VisualStyle.Office2007Blue;
            SizeF ef = new SizeF(6f, 13f);
            this.AutoScaleDimensions = ef;
            this.AutoScaleMode = AutoScaleMode.Font;
            size = new Size(0x386, 0x23b);
            this.ClientSize = size;
            this.ControlBox = false;
            this.Controls.Add(this.VsList);
            this.Controls.Add(this.Panel1);
            this.Controls.Add(this.ToolStrip1);
            this.FormBorderStyle = FormBorderStyle.FixedDialog;
            this.KeyPreview = true;
            this.Name = "Frm_KiemKeHangTonKho";
            this.StartPosition = FormStartPosition.CenterScreen;
            this.Tag = "ST-0004";
            this.Text = "KIEM KE HANG TON KHO";
            this.ToolStrip1.ResumeLayout(false);
            this.ToolStrip1.PerformLayout();
            this.Panel1.ResumeLayout(false);
            this.Panel1.PerformLayout();
            this.VsList.EndInit();
            this.ResumeLayout(false);
            this.PerformLayout();
        }

        private void Label2_Click(object sender, EventArgs e)
        {
        }

        private DataTable LayDuLieuIn(string khoaKho, string ngay)
        {
            DataTable table;
            try
            {
                object obj2 = "select KKCT.KhoaHangHoa,KKCT.KhoaQuayKe,KKCT.SoLoHang,KKCT.SoSeri,KKCT.NgayNhap,KKCT.HanSuDung,  HH.Ma,HH.Ten" + modGeneral.H_LANGUAGE + " as TenHangHoa,DVT.Ten" + modGeneral.H_LANGUAGE + " as DVT,KKCT.SoLuongTon,KKCT.SoLuongKiemKe as SoKiemKe,KKCT.TriGiaTon,KKCT.SoLuongChenhLech as ChenhLech   from ST_KiemKeHangHoaChiTiet KKCT left join DM_HangHoa HH on KKCT.KhoaHangHoa=HH.Khoa  left join DM_DonViTinh DVT on HH.KhoaDonViTinh=DVT.Khoa left join ST_KiemKeHangHoa KK on KKCT.KhoaKiemKe=KK.Khoa where KK.NgayKiemKe='" + ngay + "' and KKCT.KhoaKho='" + khoaKho + "' order by HH.Ma ";
                table = DBHelper.ExecuteDataset(modGeneral.ConnectionString, CommandType.Text, Conversions.ToString(obj2), new IDataParameter[0]).Tables[0];
            }
            catch (Exception exception1)
            {
                ProjectData.SetProjectError(exception1);
                Exception exception = exception1;
                Interaction.MsgBox(exception.Message.ToString(), MsgBoxStyle.OkOnly, null);
                table = null;
                ProjectData.ClearProjectError();
                return table;
                ProjectData.ClearProjectError();
            }
            return table;
        }

        private void LoadHangHoa(string namThang, string khoaKho = "")
        {
            string str = " where TK.NamThang='" + namThang;
            if (khoaKho != "")
            {
                str = Conversions.ToString(Microsoft.VisualBasic.CompilerServices.Operators.ConcatenateObject(Microsoft.VisualBasic.CompilerServices.Operators.ConcatenateObject(str + " and TK.KhoaKho='", this.CobKho.SelectedValue), "'"));
            }
            try
            {
                string commandText = "select KhoaKho,TK.KhoaHangHoa,TK.KhoaQuayKe,TK.SoLoHang,TK.SoSeri,TK.NgayNhap,TK.HanSuDung,HH.Ma,HH.Ten" + modGeneral.H_LANGUAGE + " as TenHangHoa,DVT.Ten" + modGeneral.H_LANGUAGE + " as TenDVT ,SoLuongTonDau+SoLuongNhap-SoLuongXuat as TonKho,SoLuongTonDau+SoLuongNhap-SoLuongXuat as SoKiemKe,TK.TriGiaTonDau+TK.TriGiaNhap-TK.TriGiaXuat as TriGiaTon ,0 as ChenhLech  from st_TonKhoDauKy TK left join DM_HangHoa HH on TK.KhoaHangHoa=HH.Khoa left join DM_Kho K on TK.KhoaKho=K.Khoa  left join DM_DonViTinh DVT on HH.KhoaDonViTinh=DVT.Khoa " + str + " order by HH.Ma ";
                this.VsList.DataSource = DBHelper.ExecuteDataset(modGeneral.ConnectionString, CommandType.Text, commandText, new IDataParameter[0]).Tables[0];
                C1.Win.C1FlexGrid.C1FlexGrid vsList = this.VsList;
                vsList.Cols[0].Visible = false;
                vsList.Cols[1].Visible = false;
                vsList.Cols[2].Visible = false;
                vsList.Cols[3].Visible = false;
                vsList.Cols[4].Visible = false;
                vsList.Cols[5].Visible = false;
                vsList.Cols[6].Visible = false;
                vsList.Cols[7].Caption = "M\x00e3";
                vsList.Cols[7].Width = 100;
                vsList.Cols[8].Caption = "T\x00ean h\x00e0ng h\x00f3a";
                vsList.Cols[9].Caption = "ĐVT";
                vsList.Cols[9].Width = 70;
                vsList.Cols[10].Caption = "Số lượng tồn";
                vsList.Cols[10].Width = 70;
                vsList.Cols[10].Format = "#,###,##0.##";
                vsList.Cols[11].Caption = "Số kiểm k\x00ea";
                vsList.Cols[11].Width = 70;
                vsList.Cols[11].Format = "#,###,##0.##";
                vsList.Cols[12].Visible = false;
                vsList.Cols[13].Caption = "Ch\x00eanh lệch";
                vsList.Cols[13].Width = 70;
                vsList.Cols[13].Format = "#,###,##0.##";
                vsList.Cols[8].Width = vsList.Width - ((((((vsList.Cols[13].Width + vsList.Cols[11].Width) + vsList.Cols[10].Width) + vsList.Cols[9].Width) + vsList.Cols[7].Width) + 10) + SystemInformation.VerticalScrollBarWidth);
                if (vsList.Rows.Count > 1)
                {
                    vsList.Select(1, 1);
                }
                vsList = null;
                this.FillColunm(11);
            }
            catch (Exception exception1)
            {
                ProjectData.SetProjectError(exception1);
                Exception exception = exception1;
                Interaction.MsgBox(exception.Message.ToString(), MsgBoxStyle.OkOnly, null);
                ProjectData.ClearProjectError();
            }
        }

        private bool LoadHangHoaDaKiemKe(string ngay, string khoaKho)
        {
            bool flag=false;
            try
            {
                object obj2 = "select KKCT.KhoaKho,KKCT.KhoaHangHoa,KKCT.KhoaQuayKe,KKCT.SoLoHang,KKCT.SoSeri,KKCT.NgayNhap,KKCT.HanSuDung,  HH.Ma,HH.Ten" + modGeneral.H_LANGUAGE + " as TenHangHoa,DVT.Ten" + modGeneral.H_LANGUAGE + " as TenDVT,KKCT.SoLuongTon,KKCT.SoLuongKiemKe,KKCT.TriGiaTon,KKCT.SoLuongChenhLech ,KKCT.KhoaKiemKe  from ST_KiemKeHangHoaChiTiet KKCT left join DM_HangHoa HH on KKCT.KhoaHangHoa=HH.Khoa  left join DM_DonViTinh DVT on HH.KhoaDonViTinh=DVT.Khoa left join ST_KiemKeHangHoa KK on KKCT.KhoaKiemKe=KK.Khoa where KK.NgayKiemKe='" + ngay + "' and KKCT.KhoaKho='" + khoaKho + "' order by HH.Ma ";
                this.VsList.DataSource = DBHelper.ExecuteDataset(modGeneral.ConnectionString, CommandType.Text, Conversions.ToString(obj2), new IDataParameter[0]).Tables[0];
                C1.Win.C1FlexGrid.C1FlexGrid vsList = this.VsList;
                vsList.Cols[0].Visible = false;
                vsList.Cols[1].Visible = false;
                vsList.Cols[2].Visible = false;
                vsList.Cols[3].Visible = false;
                vsList.Cols[4].Visible = false;
                vsList.Cols[5].Visible = false;
                vsList.Cols[6].Visible = false;
                vsList.Cols[7].Caption = "M\x00e3";
                vsList.Cols[7].Width = 70;
                vsList.Cols[8].Caption = "T\x00ean h\x00e0ng h\x00f3a";
                vsList.Cols[9].Caption = "ĐVT";
                vsList.Cols[9].Width = 70;
                vsList.Cols[10].Caption = "Số lượng tồn";
                vsList.Cols[10].Width = 70;
                vsList.Cols[10].Format = "#,###,##0.##";
                vsList.Cols[11].Caption = "Số kiểm k\x00ea";
                vsList.Cols[11].Width = 70;
                vsList.Cols[11].Format = "#,###,##0.##";
                vsList.Cols[12].Visible = false;
                vsList.Cols[13].Caption = "Ch\x00eanh lệch";
                vsList.Cols[13].Width = 70;
                vsList.Cols[13].Format = "#,###,##0.##";
                vsList.Cols[14].Visible = false;
                vsList.Cols[8].Width = vsList.Width - (((((vsList.Cols[13].Width + vsList.Cols[11].Width) + vsList.Cols[10].Width) + vsList.Cols[9].Width) + vsList.Cols[7].Width) + 10);
                vsList = null;
                this.FillRows();
                this.FillColunm(11);
                if (this.VsList.Rows.Count > 1)
                {
                    this.VsList.Select(1, 1);
                    return true;
                }
                flag = false;
            }
            catch (Exception exception1)
            {
                ProjectData.SetProjectError(exception1);
                Exception exception = exception1;
                Interaction.MsgBox(exception.Message.ToString(), MsgBoxStyle.OkOnly, null);
                flag = false;
                ProjectData.ClearProjectError();
                return flag;
                ProjectData.ClearProjectError();
            }
            return flag;
        }

        private void LoadKiemKe()
        {
            this.RefreshControls(false);
            if (this.DaKiemKe(LVYModule.Date2Char(Strings.Format(this.DTPNgayKK.Value, "dd/MM/yyyy")), Conversions.ToString(this.CobKho.SelectedValue), ref this.khoaKiemKe))
            {
                this.LoadHangHoaDaKiemKe(LVYModule.Date2Char(Strings.Format(this.DTPNgayKK.Value, "dd/MM/yyyy")), Conversions.ToString(this.CobKho.SelectedValue));
                this.pTask = "U";
                this.CmdAdd.Enabled = false;
                this.CmdEdit.Enabled = true;
                this.CmdDel.Enabled = true;
            }
            else
            {
                this.EmptyGrid();
                this.CmdAdd.Enabled = true;
            }
        }

        private string NgayKiemKeGanNhat(string kho)
        {
            string str;
            try
            {
                object obj3 = "select Top 1 NgayKiemKe from ST_KiemKeHangHoa where KhoaKho='" + kho + "' order by NgayKiemKe DESC";
                str = Conversions.ToString(LVYModule.ReturnIfNull(RuntimeHelpers.GetObjectValue(DBHelper.ExecuteScalar(modGeneral.ConnectionString, CommandType.Text, Conversions.ToString(obj3), new IDataParameter[0])), "", modGeneral.TypeOfValue.String).ToString());
            }
            catch (Exception exception1)
            {
                ProjectData.SetProjectError(exception1);
                Exception exception = exception1;
                Interaction.MsgBox(exception.Message.ToString(), MsgBoxStyle.OkOnly, null);
                str = "";
                ProjectData.ClearProjectError();
                return str;
                ProjectData.ClearProjectError();
            }
            return str;
        }

        private void RefreshControls(bool @bool)
        {
            this.CmdAdd.Enabled = @bool;
            this.CmdEdit.Enabled = @bool;
            this.CmdDel.Enabled = @bool;
            this.CmdSave.Enabled = @bool;
            this.CmdUnsave.Enabled = @bool;
        }

        private void RefreshGridColor()
        {
            int num3 = this.VsList.Rows.Count - 1;
            for (int i = 1; i <= num3; i++)
            {
                CellStyle style = this.VsList.Styles["White"];
                if (style == null)
                {
                    style = this.VsList.Styles.Add("White");
                    style.BackColor = Color.White;
                }
                int num4 = this.VsList.Cols.Count - 1;
                for (int j = 0; j <= num4; j++)
                {
                    //this.VsList.GetCellRange(i, j).Style = style;
                }
            }
        }

        private bool SaveChiTiet(string khoaKiemKe)
        {
            int num2 = this.VsList.Rows.Count - 1;
            for (int i = 1; i <= num2; i++)
            {
                clsKiemKeHangHoaChiTiet objKKHHCT = this.objKKHHCT;
                objKKHHCT.KhoaKiemKe = khoaKiemKe;
                objKKHHCT.KhoaKho = Conversions.ToString(this.VsList[i, 0]);
                objKKHHCT.KhoaHangHoa = Conversions.ToString(this.VsList[i, 1]);
                objKKHHCT.KhoaQuayKe = Conversions.ToString(this.VsList[i, 2]);
                objKKHHCT.SoLoHang = Conversions.ToString(this.VsList[i, 3]);
                objKKHHCT.SoSeri = Conversions.ToString(this.VsList[i, 4]);
                objKKHHCT.NgayNhap = Conversions.ToString(this.VsList[i, 5]);
                objKKHHCT.HanSuDung = Conversions.ToString(this.VsList[i, 6]);
                objKKHHCT.SoLuongTon = Conversions.ToString(Conversions.ToDouble(this.VsList[i, 10]));
                objKKHHCT.TriGiaTon = Conversions.ToString(Conversions.ToDouble(this.VsList[i, 12]));
                objKKHHCT.SoLuongKiemKe = Conversions.ToString(Conversions.ToDouble(this.VsList[i, 11]));
                objKKHHCT.SoLuongChenhLech = Conversions.ToString(Conversions.ToDouble(this.VsList[i, 13]));
                if (!this.objKKHHCT.Save())
                {
                    object obj2 = "delete ST_KiemKeHangHoa where Khoa='" + khoaKiemKe + "'";
                    DBHelper.ExecuteNonQuery(modGeneral.ConnectionString, CommandType.Text, Conversions.ToString(obj2), new IDataParameter[0]);
                    obj2 = "delete ST_KiemKeHangHoaChiTiet where KhoaKiemKe='" + khoaKiemKe + "'";
                    DBHelper.ExecuteNonQuery(modGeneral.ConnectionString, CommandType.Text, Conversions.ToString(obj2), new IDataParameter[0]);
                    return false;
                }
                objKKHHCT = null;
            }
            return true;
        }

        private void ThemMoi()
        {
            this.khoaKiemKe = modGeneral.CreatKey("ST_KiemKeHangHoa", 15, "ST");
            this.objKKHH.Khoa = this.khoaKiemKe;
            this.objKKHH.NgayKiemKe = LVYModule.Date2Char(Strings.Format(this.DTPNgayKK.Value, "dd/MM/yyyy"));
            this.objKKHH.KhoaKho = Conversions.ToString(this.CobKho.SelectedValue);
            this.objKKHH.KhoaNhanVien = modGeneral.H_USERID;
            this.objKKHH.DaXuat = 0;
            this.objKKHH.KhoaPhieuXuat = "";
            if (this.objKKHH.Save() && !this.SaveChiTiet(this.objKKHH.Khoa))
            {
                Interaction.MsgBox("Lỗi lưu dữ liệu !.Việc kiễm k\x00ea n\x00e0y thất bại.Xin vui l\x00f2ng kiễm k\x00ea lại.", MsgBoxStyle.OkOnly, null);
            }
        }

        internal virtual ToolStripButton CmdAdd
        {
            [DebuggerNonUserCode]
            get
            {
                return this._CmdAdd;
            }
            [MethodImpl(MethodImplOptions.Synchronized), DebuggerNonUserCode]
            set
            {
                EventHandler handler = new EventHandler(this.CmdAdd_Click);
                if (this._CmdAdd != null)
                {
                    this._CmdAdd.Click -= handler;
                }
                this._CmdAdd = value;
                if (this._CmdAdd != null)
                {
                    this._CmdAdd.Click += handler;
                }
            }
        }

        internal virtual ToolStripButton CmdDel
        {
            [DebuggerNonUserCode]
            get
            {
                return this._CmdDel;
            }
            [MethodImpl(MethodImplOptions.Synchronized), DebuggerNonUserCode]
            set
            {
                EventHandler handler = new EventHandler(this.CmdDel_Click);
                if (this._CmdDel != null)
                {
                    this._CmdDel.Click -= handler;
                }
                this._CmdDel = value;
                if (this._CmdDel != null)
                {
                    this._CmdDel.Click += handler;
                }
            }
        }

        internal virtual ToolStripButton CmdEdit
        {
            [DebuggerNonUserCode]
            get
            {
                return this._CmdEdit;
            }
            [MethodImpl(MethodImplOptions.Synchronized), DebuggerNonUserCode]
            set
            {
                EventHandler handler = new EventHandler(this.CmdEdit_Click);
                if (this._CmdEdit != null)
                {
                    this._CmdEdit.Click -= handler;
                }
                this._CmdEdit = value;
                if (this._CmdEdit != null)
                {
                    this._CmdEdit.Click += handler;
                }
            }
        }

        internal virtual ToolStripButton CmdExit
        {
            [DebuggerNonUserCode]
            get
            {
                return this._CmdExit;
            }
            [MethodImpl(MethodImplOptions.Synchronized), DebuggerNonUserCode]
            set
            {
                EventHandler handler = new EventHandler(this.CmdExit_Click);
                if (this._CmdExit != null)
                {
                    this._CmdExit.Click -= handler;
                }
                this._CmdExit = value;
                if (this._CmdExit != null)
                {
                    this._CmdExit.Click += handler;
                }
            }
        }

        internal virtual ToolStripButton CmdHelp
        {
            [DebuggerNonUserCode]
            get
            {
                return this._CmdHelp;
            }
            [MethodImpl(MethodImplOptions.Synchronized), DebuggerNonUserCode]
            set
            {
                this._CmdHelp = value;
            }
        }

        internal virtual ToolStripButton CmdLapPhieuXuat
        {
            [DebuggerNonUserCode]
            get
            {
                return this._CmdLapPhieuXuat;
            }
            [MethodImpl(MethodImplOptions.Synchronized), DebuggerNonUserCode]
            set
            {
                EventHandler handler = new EventHandler(this.CmdLapPhieuXuat_Click);
                if (this._CmdLapPhieuXuat != null)
                {
                    this._CmdLapPhieuXuat.Click -= handler;
                }
                this._CmdLapPhieuXuat = value;
                if (this._CmdLapPhieuXuat != null)
                {
                    this._CmdLapPhieuXuat.Click += handler;
                }
            }
        }

        internal virtual ToolStripButton CmdPrint
        {
            [DebuggerNonUserCode]
            get
            {
                return this._CmdPrint;
            }
            [MethodImpl(MethodImplOptions.Synchronized), DebuggerNonUserCode]
            set
            {
                EventHandler handler = new EventHandler(this.CmdPrint_Click);
                if (this._CmdPrint != null)
                {
                    this._CmdPrint.Click -= handler;
                }
                this._CmdPrint = value;
                if (this._CmdPrint != null)
                {
                    this._CmdPrint.Click += handler;
                }
            }
        }

        internal virtual ToolStripButton CmdSave
        {
            [DebuggerNonUserCode]
            get
            {
                return this._CmdSave;
            }
            [MethodImpl(MethodImplOptions.Synchronized), DebuggerNonUserCode]
            set
            {
                EventHandler handler = new EventHandler(this.CmdSave_EnabledChanged);
                EventHandler handler2 = new EventHandler(this.CmdSave_Click);
                if (this._CmdSave != null)
                {
                    this._CmdSave.EnabledChanged -= handler;
                    this._CmdSave.Click -= handler2;
                }
                this._CmdSave = value;
                if (this._CmdSave != null)
                {
                    this._CmdSave.EnabledChanged += handler;
                    this._CmdSave.Click += handler2;
                }
            }
        }

        internal virtual ToolStripButton CmdUnsave
        {
            [DebuggerNonUserCode]
            get
            {
                return this._CmdUnsave;
            }
            [MethodImpl(MethodImplOptions.Synchronized), DebuggerNonUserCode]
            set
            {
                EventHandler handler = new EventHandler(this.CmdUnsave_Click);
                if (this._CmdUnsave != null)
                {
                    this._CmdUnsave.Click -= handler;
                }
                this._CmdUnsave = value;
                if (this._CmdUnsave != null)
                {
                    this._CmdUnsave.Click += handler;
                }
            }
        }

        internal virtual ComboBox CobKho
        {
            [DebuggerNonUserCode]
            get
            {
                return this._CobKho;
            }
            [MethodImpl(MethodImplOptions.Synchronized), DebuggerNonUserCode]
            set
            {
                EventHandler handler = new EventHandler(this.CobKho_SelectedIndexChanged);
                if (this._CobKho != null)
                {
                    this._CobKho.SelectedIndexChanged -= handler;
                }
                this._CobKho = value;
                if (this._CobKho != null)
                {
                    this._CobKho.SelectedIndexChanged += handler;
                }
            }
        }

        internal virtual DateTimePicker DTPNgayKK
        {
            [DebuggerNonUserCode]
            get
            {
                return this._DTPNgayKK;
            }
            [MethodImpl(MethodImplOptions.Synchronized), DebuggerNonUserCode]
            set
            {
                EventHandler handler = new EventHandler(this.DTPNgayKK_ValueChanged);
                if (this._DTPNgayKK != null)
                {
                    this._DTPNgayKK.ValueChanged -= handler;
                }
                this._DTPNgayKK = value;
                if (this._DTPNgayKK != null)
                {
                    this._DTPNgayKK.ValueChanged += handler;
                }
            }
        }

        internal virtual Label Label1
        {
            [DebuggerNonUserCode]
            get
            {
                return this._Label1;
            }
            [MethodImpl(MethodImplOptions.Synchronized), DebuggerNonUserCode]
            set
            {
                this._Label1 = value;
            }
        }

        internal virtual Label Label2
        {
            [DebuggerNonUserCode]
            get
            {
                return this._Label2;
            }
            [MethodImpl(MethodImplOptions.Synchronized), DebuggerNonUserCode]
            set
            {
                EventHandler handler = new EventHandler(this.Label2_Click);
                if (this._Label2 != null)
                {
                    this._Label2.Click -= handler;
                }
                this._Label2 = value;
                if (this._Label2 != null)
                {
                    this._Label2.Click += handler;
                }
            }
        }

        internal virtual Panel Panel1
        {
            [DebuggerNonUserCode]
            get
            {
                return this._Panel1;
            }
            [MethodImpl(MethodImplOptions.Synchronized), DebuggerNonUserCode]
            set
            {
                this._Panel1 = value;
            }
        }

        internal virtual ToolStrip ToolStrip1
        {
            [DebuggerNonUserCode]
            get
            {
                return this._ToolStrip1;
            }
            [MethodImpl(MethodImplOptions.Synchronized), DebuggerNonUserCode]
            set
            {
                this._ToolStrip1 = value;
            }
        }

        internal virtual C1.Win.C1FlexGrid.C1FlexGrid VsList
        {
            [DebuggerNonUserCode]
            get
            {
                return this._VsList;
            }
            [MethodImpl(MethodImplOptions.Synchronized), DebuggerNonUserCode]
            set
            {
                MouseEventHandler handler = new MouseEventHandler(this.FG_DSHangHoa_MouseClick);
                RowColEventHandler handler2 = new RowColEventHandler(this.FG_DSHangHoa_AfterEdit);
                RowColEventHandler handler3 = new RowColEventHandler(this.FG_DSHangHoa_BeforeEdit);
                SortColEventHandler handler4 = new SortColEventHandler(this.FG_DSHangHoa_AfterSort);
                if (this._VsList != null)
                {
                    this._VsList.MouseClick -= handler;
                    this._VsList.AfterEdit -= handler2;
                    this._VsList.BeforeEdit -= handler3;
                    this._VsList.AfterSort -= handler4;
                }
                this._VsList = value;
                if (this._VsList != null)
                {
                    this._VsList.MouseClick += handler;
                    this._VsList.AfterEdit += handler2;
                    this._VsList.BeforeEdit += handler3;
                    this._VsList.AfterSort += handler4;
                }
            }
        }
    }
}

